//
//  SJPDepartmentCell.m
//  SWS_Project00
//
//  Created by 马继鵬 on 17/3/8.
//  Copyright © 2017年 SWS. All rights reserved.
//

#import "SJPDepartmentCell.h"
#import "SJPDepatmentModel.h"

@interface SJPDepartmentCell()
@property (weak,nonatomic) UIImageView* iconView;
@property (weak,nonatomic) UILabel* label;
@end
@implementation SJPDepartmentCell

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame])
    {
        [self setupUI];
        self.contentView.backgroundColor = [UIColor whiteColor];
    }
    return self;
}

#pragma
#pragma-设置UIjiemian

- (void)setupUI{
    //添加图片
    UIImageView* iconView = [[UIImageView alloc]init];
    _iconView = iconView;
    [self.contentView addSubview:iconView];
    
    [iconView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.offset(0);
        make.top.offset(27);
        make.width.height.mas_equalTo(47);
    }];
    
    //添加Label
    UILabel* label = [UILabel EPM_labelWithTitle:nil textColor:[UIColor blackColor] font:15];
    _label = label;
    label.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:label];
    
    [label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.offset(0);
        make.top.equalTo(iconView.mas_bottom).offset(17);
    }];
    
    
}
#pragma
#pragma-数据设置
- (void)setModel:(SJPDepatmentModel *)model
{
    _model = model;
    UIImage* image = [UIImage imageNamed:model.icon];
    _iconView.image = image;
    
    _label.text = model.title;
}


@end
